#!/bin/sh
# Start/stop piezometer daemon.

test -f /usr/bin/piezometer || exit 0

case "$1" in
start)	echo -n "Starting piezometer service: piezometer"
        echo "$(date) - Starting Piezometer service" >> /var/log/rebootlog
        start-stop-daemon --start --quiet --pidfile /var/run/piezometer.pid --name piezometer --startas /usr/bin/piezometer &
        echo "." 
        ;;
stop)	echo -n "Stopping Piezometer service: piezometer"
        start-stop-daemon --stop --quiet --pidfile /var/run/piezometer.pid --name piezometer
        echo "."
        ;;
restart) echo -n "Restarting service: piezometer"
        start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/piezometer.pid --name piezometer
        start-stop-daemon --start --quiet --pidfile /var/run/piezometer.pid --name piezometer --startas /usr/bin/piezometer &
        echo "."
        ;;
*)	echo "Usage: /etc/init.d/piezometer start|stop|restart"
        exit 1 
        ;;
esac
exit 0
